let seList = [
  {
    title: "百度",
    name: "baidu",
    toLinkUrl: "https://www.baidu.com/s?tn=15007414_9_dg&ie=utf-8&wd=",
  },
  {
    title: "谷歌",
    name: "google",
    toLinkUrl: "https://www.google.com/search?q=",
  },
  {
    title: "必应",
    name: "bing",
    toLinkUrl: "https://www.bing.com/search?q=",
  },
  {
    title: "搜狗",
    name: "sougou",
    toLinkUrl: "https://www.sogou.com/sogou?query=",
  },
];

// 获取搜索引擎列表
export const getSEList = () => {
  return seList;
};

// 获取根据name搜索引擎数据
export const findSEDataByName = (name) => {
  return seList.find((item) => {
    return item.name == name;
  });
};

// 获取上一次使用的搜索引擎
export const getLastUseSEData = () => {
  let lastSEName = localStorage.getItem("lastSEName");

  return seList.find((item) => {
    return item.name == lastSEName;
  });
};

// 设置当前的使用的搜索引擎，方便下次进入时查询
export const setCurrentUseSE = (name) => {
  localStorage.setItem("lastSEName", name);
};
